package com.thread.interruptThread;

public class InterruptThread3 implements Runnable {

	@Override
	public void run() {
		while (!Thread.currentThread().isInterrupted()) {
			try {
				System.out.println("I am count");
				Thread.sleep(100);
			} catch (InterruptedException e) {
				Thread.currentThread().interrupt();
			}
		}
	}

	public static void main(String[] args) throws InterruptedException {
		InterruptThread3 thread3 = new InterruptThread3();
		Thread t = new Thread(thread3);
		t.start();

		Thread.sleep(1000);

		System.out.println("开始线程中断");
		t.interrupt();
	}
}
